<template>
  <div v-if="isShow">
    <slot></slot>
  </div>
</template>

<script>
export default {
  name: "Power",
  props: {
    power: {
      type: String
    }
  },
  data(){
    return {
      isShow: false
    }
  },
  mounted(){
    //当前需要的权限
    //this.power;
    //当前拥有的权限
    var user = JSON.parse(localStorage.getItem("user"));
    var powers = user.authorities;
    for(var i = 0; i < powers.length; i++){
      console.log(powers[i] + "---" + this.power);
      if(powers[i] == this.power){
        //显示当前的按钮
        this.isShow = true;
      }
    }
  }
}
</script>

<style>
</style>
